<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
       
        #di{
            height: 100%;
        background-color: mediumorchid;
        display: none;
        }

        .bei{
    background-color: mediumblue;
    width: 400px;
    height: 400px;
    margin: auto;
    display: none;
 

}
span{
    background-color: mintcream;
}
    </style>
</head>
<body>
    <div >
        <div id="di">

        </div>
<button onclick="tanchu()">弹出</button>
<div class="bei">
    <span onclick="shanchu()">X</span>
</div>
    </div>
</body>
</html>
<script>
    let arr=document.getElementsByClassName("bei")
    console.log(arr);
    let arr1=document.getElementById('di')
  console.log(arr1);
function shanchu(){
    arr1.style.display="none";
    arr.style.display="none"
}
function tanchu(){
    console.log(1);
    arr.style.display = "block";
                arr1.style.display = "block";

}
</script>